﻿using System;
using Unity.Type.BinaryType;
using Xunit;

namespace Unity.Type.Tests.BinaryType
{
    public class GlobalStatusTest
    {
        private GlobalStatus? FoundGlobalStatusEnumByValue(byte value)
        {
            switch (value)
            {
                case 1:
                    return GlobalStatus.Authenticated;
                case 2:
                    return GlobalStatus.InvalidKeystore;
                case 3:
                    return GlobalStatus.CsiIdEemsNotRegistered;
                case 4:
                    return GlobalStatus.CsiIdEemsUnavailable;
                case 5:
                    return GlobalStatus.ForcedOffline;
                case 6:
                    return GlobalStatus.ConnectionNotInitialized;
                default:
                    return null;
            }
        }
        
        [Fact]
        public void EnumValuesTest()
        {
            Assert.Equal(GlobalStatus.Authenticated, FoundGlobalStatusEnumByValue(1));
            Assert.Equal(GlobalStatus.InvalidKeystore, FoundGlobalStatusEnumByValue(2));
            Assert.Equal(GlobalStatus.CsiIdEemsNotRegistered, FoundGlobalStatusEnumByValue(3));
            Assert.Equal(GlobalStatus.CsiIdEemsUnavailable, FoundGlobalStatusEnumByValue(4));
            Assert.Equal(GlobalStatus.ForcedOffline, FoundGlobalStatusEnumByValue(5));
            Assert.Equal(GlobalStatus.ConnectionNotInitialized, FoundGlobalStatusEnumByValue(6));
            Assert.Null(FoundGlobalStatusEnumByValue(Byte.MinValue));
            Assert.Null(FoundGlobalStatusEnumByValue(Byte.MaxValue));
        }
    }
}